import { useState, useEffect } from 'react'
import axios from 'axios'
import { API } from '../config'
// 获取产品分类
export default function ProductCategories () {
	const [categories, setCategories] = useState([])
	useEffect(() => {
		async function getCategory () {
			let { data } = await axios.get(`${API}/categories`)
			setCategories(data)
		}
		getCategory()
	}, [])
	return categories
}
